Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalize category storage PID on TYPO3v12 #312

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mbrodala
Copy link
Contributor

The new TypoScript parser introduced in TYPO3v12 yields a regular integer in case of a single storagePid. Only in case of a CSV this will be a string. This in turn leads to explode() failing with a type error in the integer case.

Fix this by normalizing the setting value to string.

Fixes: #301

@linawolf
Copy link
Contributor

This patch solves the issue for the CategoryRepository, however we have the same issue in the PostRepository

@linawolf
Copy link
Contributor

normalizePost.patch

Attached patch also solves this for the PostRepository

The new TypoScript parser introduced in TYPO3v12 yields a regular integer in case of a single storagePid. Only in case of a CSV this will be a string. This in turn leads to explode() failing with a type error in the integer case.

Fix this by normalizing the setting value to string.

Fixes: TYPO3GmbH#301
@mbrodala
Copy link
Contributor Author

Thanks, I've refreshed the PR, included your change and also did the same for the TagRepository.

@linawolf
Copy link
Contributor

@mbrodala your solution would still fail if the setting contained a non-scalar value like an array. It would be safer to test if it is set to a scalar value as I did in my patch, first.

@mbrodala
Copy link
Contributor Author

That is something left to do in case TYPO3 ever supports this. Right now it can only be a string, the implicit conversion to a number could be considered a unintended side-effect.

Do you have an example where storagePid could be an array?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

explode() - string required, int passed
2 participants